05. How to Convert to Longitudinal Level
How to Convert to Longitudinal Level
ND320 AIHCND C01 L03 A05 Convert Longitudinal V2
Converting Encounter to Longitudinal Representation Key Points
Note: In this walkthrough, we continued to use the synthetic dataset from the previous walkthrough.
- Inspect the data!
Remember that when working with longitudinal data it is vitally important that we inspect the data.
Create a new dataframe that groups the data by "patient_id". Again you can use
groupby()
andagg()
methods.Inspect and compare the data again by selecting a single patient and compare the "encounter", "principal_diagnosis", and "procedure_codes".
You should see all of these codes represented in arrays/lists for each patient.
Example:
list(longitudinal_example_patient_history['encounter_id'].values)
Output: [['encounter_id_2352', 'encounter_id_7434','encounter_id_1393']]
Code
If you need a code on the https://github.com/udacity.